package httpgui;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

public class URLParamsNoCloseController implements Initializable {
	@FXML
	private HBox hboxParams;
	@FXML
	private TextField textKey;

	@FXML
	private TextField textValue;

	@Override
	public void initialize(URL location, ResourceBundle resources) {
		// TODO Auto-generated method stub
		textKey.focusedProperty().addListener(new Focuse());

	}
	
	

	

	private class Focuse implements ChangeListener<Boolean> {

		@Override
		public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
			// TODO Auto-generated method stub
			if (newValue) {
				try {
					VBox vbox = (VBox) hboxParams.getParent();
					HBox hbox=(HBox) PageTool.getPaneFromFxml("URLParams.fxml");
					int size=vbox.getChildren().size();
					vbox.getChildren().add(size-1, hbox);
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			} 
		}

	}

}
